package saa.dominio.periodo.tempo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@NamedQueries({
    @NamedQuery(name = "Bimestre.id", query = "SELECT b FROM Bimestre b WHERE b.semestre.id = :id ORDER BY b.inicio"),
@NamedQuery(name = "Bimestres", query = "SELECT b FROM Bimestre b ORDER BY b.inicio")})
public class Bimestre implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(nullable = false)
    @ManyToOne
    private Semestre semestre;
    @Column(nullable = false)
    @Temporal(TemporalType.DATE)
    private Date inicio;
    @Column(nullable = false)
    @Temporal(TemporalType.DATE)
    private Date fim;

    public Bimestre() {
        super();
    }

    public Bimestre(Semestre semestre, Date inicio, Date fim) {
        this.semestre = semestre;
        this.inicio = inicio;
        this.fim = fim;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Semestre getSemestre() {
        return semestre;
    }

    public void setSemestre(Semestre semestre) {
        this.semestre = semestre;
    }

    public Date getInicio() {
        return inicio;
    }

    public void setInicio(Date inicio) {
        this.inicio = inicio;
    }

    public Date getFim() {
        return fim;
    }

    public void setFim(Date fim) {
        this.fim = fim;
    }

}
